import request from '@/utils/request'

/**
 * 获取部门列表
 * @returns
 */
export function getList() {
  return request({
    method: 'get',
    url: '/company/department'
  })
}

/**
 * 添加子部门
 * @param {*} data 表单数据
 * @returns
 */
export function addDept(data) {
  return request({
    method: 'post',
    url: '/company/department',
    data
  })
}

/**
 * 删除部门
 * @param {*} id
 * @returns
 */
export function delDept(id) {
  return request({
    method: 'delete',
    url: '/company/department/' + id
  })
}

/**
 * 根据id获取部门详情
 * @param {*} id
 * @returns
 */
export function getDeptByid(id) {
  return request({
    method: 'get',
    url: '/company/department/' + id
  })
}

/**
 * 编辑子部门
 * @param {*} data 表单数据
 * @returns
 */
export function updateDept(data) {
  return request({
    method: 'put',
    url: '/company/department/' + data.id,
    data
  })
}
